﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NCT.Framework;
using VISS.API.Users;

namespace VISS.Web.Frontend.Modules.User.Profile {
    public partial class ImagesPage : System.Web.UI.Page {

        protected int CurrentPage;

        protected void Page_Load(object sender, EventArgs e) {
            UserContext userContext = LoginFactory.GetCurrentUser();
            CurrentPage = ConvertUtils.ToInt(Request.QueryString["page"], 1);
            if (userContext == null) {
                Response.Redirect("/login?url=" + AppSettings.RootURL + "profile/images?p=" + CurrentPage);
                return;
            }
            
            int totalImage = 0;
            idImageManageListBox.ImageList = StructureMapFactory.GetInstance<IUserImage>().GetByUserKeyWithPaging(userContext.UserKey, CurrentPage, AppSettings.PageSizeOfImage, out totalImage);
            idImageManageListBox.ImageCount = totalImage;

            // SEO
            IHeadSeo seo = this.Master as IHeadSeo;
            seo.Title = StringResources.SEO.TitleUserProfile + " | " + userContext.FullName + " | " + StringResources.SEO.TitleDefault;
            seo.Description = StringResources.SEO.DescriptionDefault;
            seo.Keywords = StringResources.SEO.KeywordsDefault;
        }
    }
}
